﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BUL;
using Entity;


namespace PM.News
{
    public partial class GroupView : System.Web.UI.Page
    {
        private string grnId = "";

        private PageBul bul = new PageBul();
        private NewsBul news = new NewsBul();

        protected void Page_Load(object sender, EventArgs e)
        {
                if (grnId != null)
                {
                    grnId = Convert.ToString(Page.RouteData.Values["grnid"]);
                }
                LoadContent(grnId);
        }


        public void LoadContent(string gri)
        {
            var list = news.News_GetByGroupNewsId(gri);
            string strMenu = "<div id=\"box_new\">";
            foreach (var items in list)
            {
                strMenu = strMenu + "<div class=\"box2\">";
                string strLink = "/News/" + items.GroupNewsId + "/" + items.Id + "/" + Common.StringClass.NameToTag(items.Name);
                strMenu = strMenu +
                          string.Format(
                              "<img src=\"{0}\" alt=\"No Image\"/>" +
                              "<div class=\"detail_new\">" +
                              "<h6><a href=\"{1}\">{2}</a>" + "</h6>" +
                              "<p>{3}</p>" +
                              "</div>",
                              items.Image, strLink, items.Name, items.Content);
                strMenu = strMenu + "</div>";
            }
            strMenu = strMenu + "</div>";
            ltrContent.Text = strMenu;
        }
    }
}